package com.atguigu.map;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class CollectionsTest {
    @Test
    public void test() {
        List list = new ArrayList();
        list.add(123);
        list.add(57);
        list.add(12);
        list.add(33);
        System.out.println(list);
        //Collections.reverse(list) 反转list
        Collections.reverse(list);
        System.out.println(list);
        //Collections.shuffle()
        Collections.shuffle(list); //随机打乱list的元素
        System.out.println(list);
        //Collections.sort():若有重写自然排序，则为自然排序
        //frequency(list,Object):返回对应元素在集合中出现的次数
        System.out.println(Collections.frequency(list,57));
    }
}
